package net.sea.springcloud.router.impl.zk;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Created by sea on 2019/5/9.
 */

@ConfigurationProperties(prefix="spring.zuul.route.zk")
public class ZuulRouteZookeeperProperties {
    private Zookeeper zk = new Zookeeper();

    public class Zookeeper {
        /**
         * 连接Zookeeper服务器的列表. 包括IP地址和端口号. 多个地址用逗号分隔. 如: host1:2181,host2:2181
         */
        private String serverLists = "127.0.0.1:2181";

        /**
         * 命名空间.
         */
        private String namespace = "zuul_route_config";

        /**
         * 等待重试的间隔时间的初始值. 单位毫秒.
         */
        private int baseSleepTimeMilliseconds = 1000;

        /**
         * 等待重试的间隔时间的最大值. 单位毫秒.
         */
        private int maxSleepTimeMilliseconds = 3000;

        /**
         * 最大重试次数.
         */
        private int maxRetries = 3;

        /**
         * 会话超时时间. 单位毫秒.
         */
        private int sessionTimeoutMilliseconds;

        /**
         * 连接超时时间. 单位毫秒.
         */
        private int connectionTimeoutMilliseconds;

        /**
         * 连接Zookeeper的权限令牌. 缺省为不需要权限验证.
         */
        private String digest;

        public String getServerLists() {
            return serverLists;
        }

        public void setServerLists(String serverLists) {
            this.serverLists = serverLists;
        }

        public String getNamespace() {
            return namespace;
        }

        public void setNamespace(String namespace) {
            this.namespace = namespace;
        }

        public int getBaseSleepTimeMilliseconds() {
            return baseSleepTimeMilliseconds;
        }

        public void setBaseSleepTimeMilliseconds(int baseSleepTimeMilliseconds) {
            this.baseSleepTimeMilliseconds = baseSleepTimeMilliseconds;
        }

        public int getMaxSleepTimeMilliseconds() {
            return maxSleepTimeMilliseconds;
        }

        public void setMaxSleepTimeMilliseconds(int maxSleepTimeMilliseconds) {
            this.maxSleepTimeMilliseconds = maxSleepTimeMilliseconds;
        }

        public int getMaxRetries() {
            return maxRetries;
        }

        public void setMaxRetries(int maxRetries) {
            this.maxRetries = maxRetries;
        }

        public int getSessionTimeoutMilliseconds() {
            return sessionTimeoutMilliseconds;
        }

        public void setSessionTimeoutMilliseconds(int sessionTimeoutMilliseconds) {
            this.sessionTimeoutMilliseconds = sessionTimeoutMilliseconds;
        }

        public int getConnectionTimeoutMilliseconds() {
            return connectionTimeoutMilliseconds;
        }

        public void setConnectionTimeoutMilliseconds(int connectionTimeoutMilliseconds) {
            this.connectionTimeoutMilliseconds = connectionTimeoutMilliseconds;
        }

        public String getDigest() {
            return digest;
        }

        public void setDigest(String digest) {
            this.digest = digest;
        }
    }

    public Zookeeper getZk() {
        return zk;
    }

    public void setZk(Zookeeper zk) {
        this.zk = zk;
    }

}
